Skip to content

Conversation

chris-lee-lb
Copy link

Currently function replaceBindings logic is not same as Laravel (based this)

    public function bindValues($statement, $bindings)
    {
        foreach ($bindings as $key => $value) {
            $statement->bindValue(
                is_string($key) ? $key : $key + 1,
                $value,
                match (true) {
                    is_int($value) => PDO::PARAM_INT,
                    is_resource($value) => PDO::PARAM_LOB,
                    default => PDO::PARAM_STR
                },
            );
        }
    }

And use is_numeric also will transform int string to int, which is unexpected.

PS: With currently PHP PDO implementation (url), when binding parameter is decimal, you can use PDO::PARAM_STR instead (there is no such PDO::PARAM_DECIMAL)

@chris-lee-lb chris-lee-lb force-pushed the develop branch 2 times, most recently from 279a2ab to d8c44c4 Compare July 1, 2023 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant